package com.aim.analysis.records;

import com.aim.analysis.artifact.Strategy;
import com.aim.util.Pair;

/**
* User: User
* Date: 6/4/14
*/
public class GameKey{

    public final String partitionKey;
    public final String gameDescription;
    public final int gameNumber;
    public final Strategy strategy;

    public GameKey(String partitionKey, String gameDescription, int gameNumber) {
        this.partitionKey = partitionKey;
        this.gameDescription = gameDescription;
        this.gameNumber = gameNumber;
        this.strategy = Strategy.get(gameDescription);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GameKey gameKey = (GameKey) o;

        if (gameNumber != gameKey.gameNumber) return false;
        if (!gameDescription.equals(gameKey.gameDescription)) return false;
        if (!partitionKey.equals(gameKey.partitionKey)) return false;
        if (strategy != gameKey.strategy) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = partitionKey.hashCode();
        result = 31 * result + gameDescription.hashCode();
        result = 31 * result + gameNumber;
        result = 31 * result + strategy.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "GameKey{" +
                "partitionKey='" + partitionKey + '\'' +
                ", gameDescription='" + gameDescription + '\'' +
                ", gameNumber=" + gameNumber +
                '}';
    }
}
